﻿@model MvcPrinciples.Models.PersonReward

@{
    ViewBag.Title = "Person rewards";
    Layout = "~/Views/_CommonLayout.cshtml";
}

<div>
	<h2>Here is the list of all person rewards</h2>
	<div style="border: cornflowerblue; border-style: solid; border-width: 2px; padding: 5px">
		<p>
			Person: <br/>
			@string.Format("Name: {0}, Birth date: {1}, Age: {2}", Model.Person.Name, Model.Person.BirthDate.ToString("D"), Model.Person.Age)
		</p>
	</div>
	<div style="border: chocolate; border-style: solid; border-width: 2px; padding: 5px">
		<p>Rewards:</p>
		@foreach (var item in Model.PersonRewards)
		{
			<div style="background-color: bisque; border: aliceblue; border-style: solid; border-width: 2px; margin: 2px; height: 50px">
				<div style="float: left; width: 60%">
					@string.Format("Title: {0}", item.Title) <br />
					@string.Format("Description: {0}", item.Description)
				</div>
				<div style="float: right; width: 40%">
					@if (item.Image.Key != Guid.Empty)
					{
						<img src="@Url.Action("GetImage", new {id = item.Image.Key, type = item.Image.Value})" style="max-height: 50px; max-width: 100px" alt="Image" />
					}
				</div>

			</div>
		}
	</div>
	<div style="border: aquamarine; border-style: solid; border-width: 2px; padding: 5px">
		<p>All avalable rewards:</p>
		@foreach (var item in Model.AllRewards)
		{
			<a style="display:block; color: black; font-style: oblique" href="@Url.Action("AddRersonReward", new { pid = Model.Person.Id, rid = item.Id })">
				<div style="background-color: beige; margin: 2px; padding-left: 5px; height: 50px">
					<p>
						<div style="float: left; width: 60%">
							@string.Format("Title: {0}", item.Title) <br />
							@string.Format("Description: {0}", item.Description)
						</div>
						<div style="float: right; width: 40%">
							@if (item.Image.Key != Guid.Empty)
							{
								<img src="@Url.Action("GetImage", new {id = item.Image.Key, type = item.Image.Value})" style="max-height: 50px; max-width: 100px" alt="Image" />
							}
						</div>
					</p>
				</div>
			</a>
		}
	</div>
</div>

